<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Initiates a restore task in the service manager and returns immediately</title>
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-base.css" />
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-medium.css" />

 </head>
 <body class="docs"><div class="navbar navbar-fixed-top">
  <div class="navbar-inner clearfix">
    <ul class="nav" style="width: 100%">
      <li style="float: left;"><a href="function.ibase-query.html">« ibase_query</a></li>
      <li style="float: right;"><a href="function.ibase-rollback-ret.html">ibase_rollback_ret »</a></li>
    </ul>
  </div>
</div>
<div id="breadcrumbs" class="clearfix">
  <ul class="breadcrumbs-container">
    <li><a href="index.html">PHP Manual</a></li>
    <li><a href="ref.ibase.html">Firebird/InterBase 函数</a></li>
    <li>Initiates a restore task in the service manager and returns immediately</li>
  </ul>
</div>
<div id="layout">
  <div id="layout-content"><div id="function.ibase-restore" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">ibase_restore</h1>
  <p class="verinfo">(PHP 5, PHP 7 &lt; 7.4.0)</p><p class="refpurpose"><span class="refname">ibase_restore</span> &mdash; <span class="dc-title">Initiates a restore task in the service manager and returns immediately</span></p>

 </div>
 
 <div class="refsect1 description" id="refsect1-function.ibase-restore-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>ibase_restore</strong></span>(<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type">resource</span> <code class="parameter">$service_handle</code></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type">string</span> <code class="parameter">$source_file</code></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type">string</span> <code class="parameter">$dest_db</code></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type">int</span> <code class="parameter">$options</code><span class="initializer"> = 0</span></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type">bool</span> <code class="parameter">$verbose</code><span class="initializer"> = <strong><code>false</code></strong></span></span><br>): <span class="type"><a href="language.types.declarations.html#language.types.declarations.mixed" class="type mixed">mixed</a></span></div>


   <p class="para rdfs-comment">
   This function passes the arguments to the (remote) database server. There it starts a new restore process. Therefore you
   won&#039;t get any responses.
  </p>
 </div>

 
 <div class="refsect1 parameters" id="refsect1-function.ibase-restore-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>
    
     <dt>
<code class="parameter">service_handle</code></dt>

     <dd>

      <p class="para">
       A previously opened connection to the database server.
      </p>
     </dd>

    
    
     <dt>
<code class="parameter">source_file</code></dt>

     <dd>

      <p class="para">
       The absolute path on the server where the backup file is located.
      </p>
     </dd>

    
    
     <dt>
<code class="parameter">dest_db</code></dt>

     <dd>

      <p class="para">
       The path to create the new database on the server. You can also use database alias.
      </p>
     </dd>

    
    
     <dt>
<code class="parameter">options</code></dt>

     <dd>

      <p class="para">
       Additional options to pass to the database server for restore.
       The <code class="parameter">options</code> parameter can be a combination 
       of the following constants:
       <strong><code>IBASE_RES_DEACTIVATE_IDX</code></strong>,
       <strong><code>IBASE_RES_NO_SHADOW</code></strong>, 
       <strong><code>IBASE_RES_NO_VALIDITY</code></strong>,
       <strong><code>IBASE_RES_ONE_AT_A_TIME</code></strong>,
       <strong><code>IBASE_RES_REPLACE</code></strong>,
       <strong><code>IBASE_RES_CREATE</code></strong>,
       <strong><code>IBASE_RES_USE_ALL_SPACE</code></strong>,
       <strong><code>IBASE_PRP_PAGE_BUFFERS</code></strong>,
       <strong><code>IBASE_PRP_SWEEP_INTERVAL</code></strong>,
       <strong><code>IBASE_RES_CREATE</code></strong>.
       Read the section about <a href="ibase.constants.html" class="xref">预定义常量</a> for further information.
      </p>
     </dd>

    
    
     <dt>
<code class="parameter">verbose</code></dt>

     <dd>

      <p class="para">
       Since the restore process is done on the database server, you don&#039;t have any chance
       to get its output. This argument is useless.
      </p>
     </dd>

    
   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.ibase-restore-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   成功时返回 <strong><code>true</code></strong>， 或者在失败时返回 <strong><code>false</code></strong>。
  </p>
  <p class="para">
   Since the restore process is done on the (remote) server, this function just passes the arguments to it.
   While the arguments are legal, you won&#039;t get <strong><code>false</code></strong>.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.ibase-restore-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-1233">
    <p><strong>示例 #1 <span class="function"><strong>ibase_restore()</strong></span> example</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /><br /></span><span style="color: #FF8000">//&nbsp;Attach&nbsp;to&nbsp;database&nbsp;server&nbsp;by&nbsp;ip&nbsp;address&nbsp;and&nbsp;port<br /></span><span style="color: #0000BB">$service&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">ibase_service_attach&nbsp;</span><span style="color: #007700">(</span><span style="color: #DD0000">'10.1.11.200/3050'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'sysdba'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'masterkey'</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">//&nbsp;Start&nbsp;the&nbsp;restore&nbsp;process&nbsp;on&nbsp;database&nbsp;server<br />//&nbsp;Restore&nbsp;employee&nbsp;backup&nbsp;to&nbsp;the&nbsp;new&nbsp;emps.fdb&nbsp;database<br />//&nbsp;Don't&nbsp;use&nbsp;any&nbsp;special&nbsp;arguments<br /></span><span style="color: #0000BB">ibase_restore</span><span style="color: #007700">(</span><span style="color: #0000BB">$service</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'/srv/backup/employees.fbk'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'/srv/firebird/emps.fdb'</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">//&nbsp;Free&nbsp;the&nbsp;attached&nbsp;connection<br /></span><span style="color: #0000BB">ibase_service_detach&nbsp;</span><span style="color: #007700">(</span><span style="color: #0000BB">$service</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

   </div>
  </p>
  
  <p class="para">
   <div class="example" id="example-1234">
    <p><strong>示例 #2 <span class="function"><strong>ibase_restore()</strong></span> example with arguments</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /><br /></span><span style="color: #FF8000">//&nbsp;Attach&nbsp;to&nbsp;database&nbsp;server&nbsp;by&nbsp;name&nbsp;and&nbsp;default&nbsp;port<br /></span><span style="color: #0000BB">$service&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">ibase_service_attach&nbsp;</span><span style="color: #007700">(</span><span style="color: #DD0000">'fb-server.contoso.local'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'sysdba'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'masterkey'</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">//&nbsp;Start&nbsp;the&nbsp;restore&nbsp;process&nbsp;on&nbsp;database&nbsp;server<br />//&nbsp;Restore&nbsp;to&nbsp;employee&nbsp;database&nbsp;using&nbsp;alias.<br />//&nbsp;Restore&nbsp;without&nbsp;indixes.&nbsp;Replace&nbsp;existing&nbsp;database.<br /></span><span style="color: #0000BB">ibase_restore</span><span style="color: #007700">(</span><span style="color: #0000BB">$service</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'/srv/backup/employees.fbk'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'employees.fdb'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">IBASE_RES_DEACTIVATE_IDX&nbsp;</span><span style="color: #007700">|&nbsp;</span><span style="color: #0000BB">IBASE_RES_REPLACE</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">//&nbsp;Free&nbsp;the&nbsp;attached&nbsp;connection<br /></span><span style="color: #0000BB">ibase_service_detach&nbsp;</span><span style="color: #007700">(</span><span style="color: #0000BB">$service</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

   </div>
  </p>
 </div>

 
 
 <div class="refsect1 seealso" id="refsect1-function.ibase-restore-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="function"><a href="function.ibase-backup.html" class="function" rel="rdfs-seeAlso">ibase_backup()</a> - Initiates a backup task in the service manager and returns immediately</span></li>
   </ul>
  </p>
 </div>


</div></div></div></body></html>